package com.supor.aiot.home.ui.device.config;

import android.os.Build;
import android.util.Log;

import com.supor.aiot.common.base.BaseConfigActivity;
import com.supor.aiot.common.base.NoViewModel;
import com.supor.aiot.home.R;
import com.supor.aiot.home.apdater.WlanDescriptionAdapter;
import com.supor.aiot.home.bean.WlanDescriptionBean;
import com.supor.aiot.home.databinding.ActivityWlandescriptionBinding;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.LinearLayoutManager;

/**
 * Description :
 *
 * @author jyt
 * @date 2021/5/21
 */
public class WlanDescriptionActivity extends BaseConfigActivity<NoViewModel, ActivityWlandescriptionBinding> {
    private WlanDescriptionAdapter mWlanDescriptionAdapter;
    private String brand = Build.BRAND;
    private List<WlanDescriptionBean> listhuawei = new ArrayList<>();
    private List<WlanDescriptionBean> listxiaomi = new ArrayList<>();
    private List<WlanDescriptionBean> listoppo = new ArrayList<>();
    private List<WlanDescriptionBean> listvivo = new ArrayList<>();

    @Override
    protected int resourceId() {
        return R.layout.activity_wlandescription;
    }

    @Override
    protected void initData() {
        super.initData();
        bindingView.toolbar.setIvLeftOnClickListener(v -> finish());
        bindingView.toolbar.setTvLeftOnClickListener(v -> finish());
        bindingView.wlandescriptionlist.setLayoutManager(new LinearLayoutManager(this));
        init();
        mWlanDescriptionAdapter.notifyDataSetChanged();
        bindingView.wlandescriptionlist.setAdapter(mWlanDescriptionAdapter);
    }

    public void init() {
        switch (brand) {
            case "HUAWEI":
            case "HONOR":
                WlanDescriptionBean WlanDescriptionBeanhuawei1 = new WlanDescriptionBean(R.drawable.huawei1, "1、点击手机“设置”，进入“WLAN”;");
                WlanDescriptionBean WlanDescriptionBeanhuawei2 = new WlanDescriptionBean(R.drawable.huawei2, "2、点击“更多WLAN设置”;");
                WlanDescriptionBean WlanDescriptionBeanhuawei3 = new WlanDescriptionBean(R.drawable.huawei3, "3、将“WLAN+”开关置于关闭状态。");
                listhuawei.add(WlanDescriptionBeanhuawei1);
                listhuawei.add(WlanDescriptionBeanhuawei2);
                listhuawei.add(WlanDescriptionBeanhuawei3);
                mWlanDescriptionAdapter = new WlanDescriptionAdapter(this, listhuawei);
                bindingView.toolbar.setLeftText("关闭“WLAN+”操作说明");
                break;
            case "vivo":
                WlanDescriptionBean WlanDescriptionBeanvivo1 = new WlanDescriptionBean(R.drawable.vivo1, "1、点击手机“设置”，进入“WLAN”;");
                WlanDescriptionBean WlanDescriptionBeanvivo2 = new WlanDescriptionBean(R.drawable.vivo2, "2、点击“网络助理”;");
                WlanDescriptionBean WlanDescriptionBeanvivo3 = new WlanDescriptionBean(R.drawable.vivo3, "3、将“智能选择最佳WLAN”和“自动切换数据网络”开关置于关闭。");
                listvivo.add(WlanDescriptionBeanvivo1);
                listvivo.add(WlanDescriptionBeanvivo2);
                listvivo.add(WlanDescriptionBeanvivo3);
                mWlanDescriptionAdapter = new WlanDescriptionAdapter(this, listvivo);
                bindingView.toolbar.setLeftText("关闭“网络助理”操作说明");
                break;
            case "OPPO":
                WlanDescriptionBean WlanDescriptionBeanoppo1 = new WlanDescriptionBean(R.drawable.oppo1, "1、点击手机“设置”，进入“WLAN”;");
                WlanDescriptionBean WlanDescriptionBeanoppo2 = new WlanDescriptionBean(R.drawable.oppo2, "2、在Wi-Fi列表下方，点击“高级设置”;");
                WlanDescriptionBean WlanDescriptionBeanoppo3 = new WlanDescriptionBean(R.drawable.oppo3, "3、点击“WLAN助理”;");
                WlanDescriptionBean WlanDescriptionBeanoppo4 = new WlanDescriptionBean(R.drawable.oppo4, "4、将“智能连接最佳WLAN网络”开关置于关闭状态。");
                listoppo.add(WlanDescriptionBeanoppo1);
                listoppo.add(WlanDescriptionBeanoppo2);
                listoppo.add(WlanDescriptionBeanoppo3);
                listoppo.add(WlanDescriptionBeanoppo4);
                mWlanDescriptionAdapter = new WlanDescriptionAdapter(this, listoppo);
                bindingView.toolbar.setLeftText("关闭“WLAN助理”操作说明");
                break;
            case "Xiaomi":
                WlanDescriptionBean WlanDescriptionBeanxiaomi1 = new WlanDescriptionBean(R.drawable.xiaomi1, "1、点击手机“设置”，进入“WLAN”;");
                WlanDescriptionBean WlanDescriptionBeanxiaomi2 = new WlanDescriptionBean(R.drawable.xiaomi2, "2、点击“WLAN助理”;");
                WlanDescriptionBean WlanDescriptionBeanxiaomi3 = new WlanDescriptionBean(R.drawable.xiaomi3, "3、点击“智能选网”;");
                WlanDescriptionBean WlanDescriptionBeanxiaomi4 = new WlanDescriptionBean(R.drawable.xiaomi4, "4、将“智能选网”开关置于关闭状态。");
                listxiaomi.add(WlanDescriptionBeanxiaomi1);
                listxiaomi.add(WlanDescriptionBeanxiaomi2);
                listxiaomi.add(WlanDescriptionBeanxiaomi3);
                listxiaomi.add(WlanDescriptionBeanxiaomi4);
                mWlanDescriptionAdapter = new WlanDescriptionAdapter(this, listxiaomi);
                bindingView.toolbar.setLeftText("关闭“WLAN助理”操作说明");
                break;
            default:
                mWlanDescriptionAdapter = new WlanDescriptionAdapter(this, listxiaomi);
                Log.i("WlanDescriptionActivity","手机品牌判定错误");
                break;
        }
    }
}

